package com.zjzywl.smoke.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.List;

@Component
@ConfigurationProperties(prefix = "app")
public class AppConfig {

	private String lightserviceip;
	private String focusByCount;
	private String lightserviceport;
	private String focusMoveByCount;
	private String getDataIp;
	private String uploadDir;

	public String getGetDataIp() {
		return getDataIp;
	}

	public void setGetDataIp(String getDataIp) {
		this.getDataIp = getDataIp;
	}

//	@Bean
//	public RestTemplate restTemplate() {
//		return new RestTemplate();
//	}
	@Bean
	public RestTemplate restTemplate() {
		List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>();
		interceptors.add(new HeaderRequestInterceptor("token", "wangj"));
		RestTemplate restTemplate = new RestTemplate();
		restTemplate.setInterceptors(interceptors);
		return restTemplate;
	}

	public String getLightserviceip() {
		return lightserviceip;
	}

	public void setLightserviceip(String lightserviceip) {
		this.lightserviceip = lightserviceip;
	}

	public String getFocusByCount() {
		return focusByCount;
	}

	public void setFocusByCount(String focusByCount) {
		this.focusByCount = focusByCount;
	}

	public String getLightserviceport() {
		return lightserviceport;
	}

	public void setLightserviceport(String lightserviceport) {
		this.lightserviceport = lightserviceport;
	}

	public String getFocusMoveByCount() {
		return focusMoveByCount;
	}

	public void setFocusMoveByCount(String focusMoveByCount) {
		this.focusMoveByCount = focusMoveByCount;
	}

	public String getUploadDir() {
		return uploadDir;
	}

	public void setUploadDir(String uploadDir) {
		this.uploadDir = uploadDir;
	}
}
